package com.xkdx.caipiao.presistence.navigation;

import java.util.ArrayList;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xkdx.caipiao.module.network.AbsModule;

public class NavigationModule extends AbsModule {

	public ArrayList<NavigationInfo> list;

	@Override
	public void parseData() throws Exception {
		try {
			backJson = (JSONArray) result;
			list = new ArrayList<NavigationInfo>();
			for (int i = 0; i < backJson.size(); i++) {
				jsonObj = (JSONObject) backJson.get(i);
				String sortOfAct = jsonObj.getString("Act");
				if (sortOfAct.equals("getnavpic")) {
					parseJifen(jsonObj.getJSONArray("DetailInfo"));
				}

			}
		} catch (Exception e) {
			throw e;
		}

	}

	private void parseJifen(JSONArray jsonArray) throws Exception {
		try {

			JSONArray array = jsonArray;
			for (int i = 0; i < array.size(); i++) {

				JSONObject obj = array.getJSONObject(i);
				NavigationInfo navigationInfo = new NavigationInfo();
				navigationInfo.setId(obj.getString("id"));
				navigationInfo.setUrl(obj.getString("url"));
				navigationInfo.setThumb(obj.getString("thumb"));

				list.add(navigationInfo);
			}

		} catch (Exception e) {

			throw e;
		}
	}
}
